﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using IiiToolkitMain.Common;

namespace IiiToolkitMain
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new ThreadExceptionEventHandler(Error);

            //args = new[]
            //{
            //    //"ewind://video?appkey=6158772aa22347e1a026e1bd8f815987&secret=5d0833881ba3111a81bf8dd40ee6c694&devicederial=585171107&channelno=1" 
            //    "ewind://video?appkey=f0b17af8aaaf4cf69c1752dd14bd29aa&secret=59b09cdab91ed6d087c58a37e651681c&devicederial=741678698&channelno=1"

            //};
            //if (args == null || args.Length < 1)
            //{
            //    //检查注册表有没有自定义的URL协议
            //    MessageBox.Show("检查注册表有没有自定义的URL协议");
            //}
            //else
            //{
            //    var url = args[0];
                
            //    var model = UrlParser.ParseUrl(url);
            //    switch (model.Type)
            //    {
            //        case AppType.Video:
            //        case AppType.InnerVideo:
            //            Application.Run(new Video(model));
            //            break;
            //        case AppType.Other:
            //            MessageBox.Show("暂未支持此类型!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //            break;
            //        case AppType.Error:
            //            MessageBox.Show("您传入的参数不正确!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //            break;
            //    }
            //}
            Application.Run(new _9800Form());
        }

        private static void Error(object sender, ThreadExceptionEventArgs threadExceptionEventArgs)
        {
            MessageBox.Show(threadExceptionEventArgs.Exception.Message);
        }
    }
}
